Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

343
Visualizações
Option "useFindAndModify" is not supported

I'm trying to connect to my database using mongoose and in my console is displaying ' option usefindandmodify is not supproted '. I'm using mongoose 6.0.0

this is my code

  mongoose.connect(constants.CONNECTION_URL,
     { useNewUrlParser: true,
       useUnifiedTopology: true, 
       useFindAndModify: false 
     })
.then(() => app.listen(constants.PORT, () => console.log(`Server Running on Port ${constants.PORT}`)))
.catch((error) => console.log(error.message));

mongoose.Promise = global.Promise;

can someone suggest me how can I get rid of that? is written with white if matters neither green nor red, white.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Starting with Mongoose version 6, you should not specify that as an option. It will be handled automatically.

This issue is explained here.

useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. Mongoose 6 always behaves as if useNewUrlParser, useUnifiedTopology, and useCreateIndex are true, and useFindAndModify is false. Please remove these options from your code.

over 4 years ago · Santiago Trujillo Relatório

0

i got this error too , so i fixed that like this
i guess useNewUrlParser, useUnifiedTopology, useFindAndModify are no longer available

mongoose.connect(constants.CONNECTION_URL).then(() => app.listen(constants.PORT, () => console.log(`Server Running on Port ${constants.PORT}`)))
.catch((error) => console.log(error.message));

mongoose.Promise = global.Promise;

mongoose.connect(CONNECTION_URL) .then(() => app.listen(PORT, () => console.log(Server running on port ${PORT})) ).catch((error) => console.log(error.message));
over 4 years ago · Santiago Trujillo Relatório

0

New version of Mongoose don't support useFindAndModify, you don't have to write it in your code, Mongoose by default takes useFindAndModify as false.

just remove useFindAndModify from your code.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda